/**
 * v-hasPermi 操作权限处理
 * Copyright (c) 2019 ruoyi
 */

import useUserStore from "@/store/modules/user";

export default {
    mounted: (el, binding) => {
        console.log("===================");
        console.log(el, el.parentNode, binding);
        const adminPermis = "*:*:*";
        // 拿到后端返回的
        const allPermissions = useUserStore().permissions;
        const currentBtnPermisons = binding.value;
        const hasPermi =
            allPermissions[0] === adminPermis ||
            allPermissions.includes(currentBtnPermisons);
        if (!hasPermi) {
            // hasPermi ==false  证明没资格看到按钮 删掉

            el.parentNode?.removeChild(el);
        }
    }
};
